{% extends 'TopxiaWebBundle:CourseManage:layout.html.twig' %}

{% block title %}{% if setting('default.user_name') %}{{ setting('default.user_name')|default('学员'|trans) }}{% else %}{{ '学员'|trans }}{% endif %}{{ '管理'|trans }} - {{ parent() }}{% endblock %}

{% set side_nav = 'students' %}
{% set script_controller = 'course-manage/students' %}

{% block main %}
  <div class="panel panel-default panel-col">
  <div class="panel-heading">
  {% if setting('default.user_name') %}{{ setting('default.user_name')|default('学员'|trans) }}{% else %}{{ '学员'|trans }}{% endif %}{{ '管理'|trans }}
  {% if role == 'student' %}
    {% if app.user.isAdmin() or setting('course.teacher_export_student', false) %}
      <a class="btn btn-info btn-sm pull-right mhs" id="export-students-btn" href="javascript:;" data-url="{{ path('course_manage_student_export_csv', {id:course.id,role:'student'}) }}" data-datas-url="{{ path('course_manage_student_export_datas', {id:course.id}) }}" data-loading-text="正在导出"><i
            class="glyphicon glyphicon-export"></i> {{ '导出'|trans }}{% if setting('default.user_name') %}{{ setting('default.user_name')|default('学员'|trans) }}{% else %}{{ '学员'|trans }}{% endif %}
      </a>
    {% endif %}
    {% if app.user.isAdmin() or setting('course.teacher_manage_student', 0) %}

      {% if course.status == 'published' %}
        <a class="btn btn-info pull-right btn-sm mhs" data-toggle="modal" data-target="#modal"
           data-url="{{ path('importer_index', {type: 'course-member', courseId:course.id}) }}"><i
              class="glyphicon glyphicon-import"></i> {{ '批量导入'|trans }}</a>
      {% else %}
        <a class="btn btn-info pull-right btn-sm mhs" disabled data-toggle="tooltip" data-placement="top"
           title="{{ '课程未发布,不可导入学员'|trans }}"><i class="glyphicon glyphicon-import"></i> {{ '批量导入'|trans }}</a>

      {% endif %}
      <button class="btn btn-info btn-sm pull-right mhs" id="student-add-btn" data-toggle="modal" data-target="#modal"
              data-url="{{ path('course_manage_student_create', {id:course.id}) }}"><i
            class="glyphicon glyphicon-plus"></i> {{ '添加'|trans }}{% if setting('default.user_name') %}{{ setting('default.user_name')|default('学员'|trans) }}{% else %}{{ '学员'|trans }}{% endif %}
      </button>
    {% endif %}
    </div>

    <div class="panel-body">
      <ul class="nav nav-tabs mbl">
        <li class="{% if submenu|default() == 'student' %}active{% endif %}">
          <a href="{{ path('course_manage_students',{id:course.id}) }}">{{ '正式学员'|trans }}
          </a>
        </li>

        <li class="{% if submenu|default() == 'record' %}active{% endif %}">
          <a href="{{ path('course_manage_record',{id:course.id}) }}">{{ '退出记录'|trans }}
          </a>
        </li>
      </ul>

      {% block maincontent %}{% endblock %}
    </div>
    </div>
  {% endif %}
{% endblock %}